#include <stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/wait.h>
int main()
{
  pid_t id = fork();
  if(id == 0)
  {
    //子进程,调用别的语言写的程序
    //execlp("python", "python", "test.py", NULL);
    execlp("./test.py", "test.py", NULL);
    exit(-1);
  }
  else{
    //父进程
    int status = 0;
    printf("父进程开始等待: \n");
    int ret = waitpid(-1, &status, 0); //阻塞等待
    if(ret > 0)
    {
      printf("父进程等待成功，子进程退出码为：%d \n",WEXITSTATUS(status));

    }
  }
  return 0;
}
